package test3_31;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Homework17_5 {

    public static void main(String[] args) {
        String[] country = new String[]{"科特迪瓦", "阿根廷", "澳大利亚", "塞尔维亚", "荷兰", "尼日利亚", "日本", "美国", "中国", "新西兰", "巴西", "比利时", "韩国", "喀麦隆", "洪都拉斯", "意大利"};

        ArrayList<String> list = new ArrayList<>();
        for (int i = 0; i < country.length; i++) {
            list.add(country[i]);
        }

        for (int i = 0; i < list.size(); i++) {
            int index = (int) (Math.random() * 16);
            String temp = list.get(i);
            list.set(i, list.get(index));
            list.set(index, temp);
        }
        System.out.println(list);

        for (int i = 0; i < list.size(); i = i + 4) {
            List<String> group = list.subList(i, i + 4);
            System.out.println("第 " + (i / 4 + 1) + " 组: " + group);
        }
    }
}
